<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
	<title>Cadastro de Entrega</title>
</h:head>
<h:body>
	<h:form id="rota">
		<p:growl id="confirmaEmpresa" />
		
		<p:fieldset legend="Cadastrar Entrega">
		
		
		<font style="font-size: 12;"> <h:outputText
					value="Localizar Nota Fiscal:" /> </font>
			<fieldset>
				<h:panelGrid columns="1">

					<h:outputLabel value="Digite o Nº da NF:" style="color:red;" />

					<h:panelGrid columns="2">

						<p:inputText value="#{entregaAction.codNotaFiscal}" />

						<p:commandButton id="procurarNotafiscal" ajax="false" value="Buscar"
							actionListener="#{entregaAction.localizarNotafiscal}"
							update="rota" />


					</h:panelGrid>
				</h:panelGrid>
			</fieldset>

			
			<h:panelGrid columns="1">
				<h:outputLabel value="Nome da Pessoa que Recebeu:"
					rendered="#{entregaAction.botao}" />
				<p:inputText value="#{entregaAction.entrega.nomeRecebedor}"
					rendered="#{entregaAction.botao}" />
				<h:outputLabel value="Nº RG:" rendered="#{entregaAction.botao}" />
				<p:inputText value="#{entregaAction.entrega.identidade}"
					rendered="#{entregaAction.botao}" />
				<h:outputLabel value="Data:" rendered="#{entregaAction.botao}" />
				<p:calendar value="#{entregaAction.entrega.data}" mode="popup"
					rendered="#{entregaAction.botao}" navigator="true" size="08"
					pattern="dd.MM.yyyy">
				</p:calendar>
				<p:commandButton id="salvandoEntrega" value="Salvar"
					actionListener="#{entregaAction.salvarEntrega}"
					update="confirmaEmpresa" onclick="telaCadas.show()" />

			</h:panelGrid>


		</p:fieldset>

		<p:dialog id="telaConfirmacaoCadastro"
			rendered="#{entregaAction.cadastrarRota}" widgetVar="telaCadas"
			width="250" height="120" header="Entrega Cadastrada"
			resizable="false" modal="true">

			<h:outputLabel value="Dados armazenados com sucesso!"
				style="color:blue;" />
			<h:panelGrid cellspacing="15">
				<p:commandButton value="Ok"
					actionListener="#{entregaAction.redirecionePaginaCadastro}"
					oncomplete="telaCadas.hide()" />


			</h:panelGrid>


		</p:dialog>



	</h:form>

</h:body>


</html>